import config from '../utils/config'
// 发送 ajax 请求


export default (url, data = {}, method='GET')=> {
  return new Promise((reslove, reject)=> {
    wx.request({
      url: config.host + url,
      data,
      method,
      header: {
        "content-type": "application/x-www-form-urlencoded",
        "Cookie": `cookie=${wx.getStorageSync('cookie')}`
      },
      success: (res)=> {
        reslove(res.data)
      },
      fail: (err) => {
        reject(err)
      }
    })
  })
}